package cn.itcast.mq.config;


import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * TODO
 *
 * @Author yiWen
 * @Date 2025/1/511:13
 */
@Configuration
public class RabbitConfig {
    /**
     * 声明队列
     */
    @Bean
    public Queue simpleQueue(){
        return new Queue("simple.queue",true);
    }
    /**
     * 声明队列
     */
    @Bean
    public Queue workQueue(){
        return new Queue("work.queue",true);
    }

    @Bean
    public Queue fanoutQueue1(){
        return new Queue("fanout.queue1",true);
    }
    @Bean
    public Queue fanoutQueue2(){
        return new Queue("fanout.queue2",true);
    }
    @Bean
    public FanoutExchange fanoutExchange(){
        return new FanoutExchange("fanout.exchange");
    }
    @Bean
    public Binding bindFanout(Queue fanoutQueue1,  FanoutExchange fanoutExchange){
        return BindingBuilder.bind(fanoutQueue1).to(fanoutExchange);

    }
    @Bean
    public Binding bindFanout2(Queue fanoutQueue2,  FanoutExchange fanoutExchange){
        return BindingBuilder.bind(fanoutQueue2).to(fanoutExchange);
    }

}
